using NUnit.Framework;
using Rhino.Mocks;

namespace Kym.Testing
{
    public abstract class ContextSpecification<T> where T : class
    {
        protected T Sut { get; private set; }

        [SetUp]
        public void setup()
        {
            Sut = establish_context();
            because();
        }

        [TearDown]
        public void teardown()
        {
            after_each_specification();
        }

        protected virtual T establish_context() 
        {
            return default(T); 
        }
        
        protected virtual void because() {}
        protected virtual void after_each_specification() {}

        protected static InterfaceType Dependency<InterfaceType>()
        {
            return MockRepository.GenerateMock<InterfaceType>();
        }

        protected static InterfaceType Stub<InterfaceType>()
        {
            return MockRepository.GenerateStub<InterfaceType>();
        }
    }
}